package com.srv.servlet;


import javax.servlet.http.HttpServletRequest;

import com.srv.TheException;
import com.srv.model.User;

public class RequestTool {
    private final static String ID="id";
    private final static String NAME="name";
    /**
     * 获取用户对象.
     * @param request
     * @return
     * @throws TheException
     */
	public static User getAccessUser(HttpServletRequest request) throws TheException{
		//先测试用，这个地方涉及到session、永久登陆,比较复杂
		User theUser = new User();
//		theUser.id = "123131";
		theUser.pid = 1;
		return theUser;		
	}
	/**
	 * 获取ID值
	 * @param request
	 * @return
	 * @throws TheException
	 */
	public static String getValueOfID(HttpServletRequest request){
		return request.getParameter(ID);
	}
	/**
	 * 获取Name值
	 * @param request
	 * @return
	 * @throws TheException
	 */
	public static String getValueOfName(HttpServletRequest request){
		return request.getParameter(NAME);
	}
}
